package com.itheima;

import com.sun.jdi.DoubleValue;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class MapDemo {
    public static void main(String[] args) {
        test0();
    }
    public static void test3(){
        Map<String,Double>map=new HashMap<>();
        map.put("张三",200.0);
        map.put("李四",100.0);
        map.put("王五",300.0);
        map.put("赵六",200.0);
        map.forEach((key,value)-> System.out.println(key+"-----"+value));
    }




    public static void test2(){
        Map<String,Double>map=new HashMap<>();
        map.put("张三",200.0);
        map.put("李四",100.0);
        map.put("王五",300.0);
        map.put("赵六",200.0);
        Set<Map.Entry<String,Double>>entrySet=map.entrySet();

        for(Map.Entry<String,Double>entry:entrySet){
            String key=entry.getKey();
            Double value=entry.getValue();
            System.out.println(key+"----"+value);
        }

    }


    public  static void test1(){
        Map<String,Double>map=new HashMap<>();
        map.put("张三",200.0);
        map.put("李四",100.0);
        map.put("王五",300.0);
        map.put("赵六",200.0);
        Set<String>keySet=map.keySet();
        for(String key :keySet){
            Double value=map.get(key);
            System.out.println(key+"---"+value);
        }
    }



    public static  void test0(){
        Map<String,Double>map=new HashMap<>();
        map.put("张三",200.0);
        map.put("李四",100.0);
        map.put("王五",300.0);
        map.put("赵六",200.0);
        System.out.println(map);
        map.remove("张三");
        boolean b1=map.containsKey("李四");
        System.out.println("b1="+b1);
        boolean b2=map.containsKey(200.0);
        System.out.println("b2"+b2);

        int size=map.size();
        System.out.println("size"+size);

    }
}
